home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # WIDE AREA INFORMATION SERVER SOFTWARE:
- # No guarantees or restrictions. See the readme file for the full standard
- # disclaimer.
- #
- # A shell script to retrieve a document from the docid.
- #
- # Author: jonathan@think.com
- # Date: Sun Feb 16 1992
- #
- # Change log:
- # $Log: waisretrieve.script,v $
- # Revision 1.1 1994/08/05 06:57:45 pfeifer
- # Initial revision
- #
- # Revision 1.3 92/04/28 15:39:21 jonathan
- # Added DEBUG option
- #
- # Revision 1.2 92/02/16 18:36:12 jonathan
- # Modified usage (and test)
- #
- # Revision 1.1 92/02/16 18:30:11 jonathan
- # Initial revision
- #
- #
-
- if (test $# -ne 1)
- then
- echo "usage: $0 DOC_SPEC"
- echo " where DOC_SPEC is docid:database[@host[:port]][%type]"
- echo " docid and database are server specific,"
- echo " host and port are optional."
- exit 1
- fi
-
- tdir=/tmp
- qfile=$tdir/wr$$.q
- sfile=wr$$.src
- db=`echo $1 | awk -F: '{print $2}' | awk -F@ '{print $1}'`
- host=`echo $1 | awk -F: '{print $2}' | awk -F@ '{print $2}'`
- id=`echo $1 | awk -F: '{print $1}'`
- tcpport=`echo $1 | awk -F: '{print $3}' | awk -F% '{print $1}'`
- type=`echo $1 | awk -F% '{print $2}'`
- if (test -n "$tcpport")
- then
- port=$tcpport
- else
- port=210
- fi
-
- cat >$tdir/$sfile <<EoF
- (:source
- :version 3
- :database-name "$db"
- :ip-name "$host"
- :tcp-port $port
- )
- EoF
-
- cat >$qfile <<EoF
- (:question :version 2
- :result-documents
- ( (:document-id
- :document
- (:document
- :doc-id
- (:doc-id :original-database `stringtoany $db`
- :original-local-id `stringtoany "$id"` )
- :number-of-bytes -1
- :type "$type"
- :source
- (:source-id :filename "$sfile") ) ) ) )
- EoF
-
- waisq -f $qfile -s $tdir/ -v 1
-
- $DEBUG rm $qfile $tdir/$sfile
-